import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 配置路由
    {
      path: '/',
      name: 'Index',
      component: () => import('@/views/index.vue'),
      redirect: '/home',
      children: [
        {
          path: '/category',
          name: 'Category',
          component: () => import('@/views/category/index.vue')
        },
        {
          path: '/home',
          name: 'Home',
          component: () => import('@/views/home/index.vue')
        },
        {
          path: '/cart',
          name: 'Cart',
          component: () => import('@/views/cart/index.vue')
        },
        {
          path: '/user',
          name: 'User',
          component: () => import('@/views/user/index.vue')
        },
        {
          path: '/detail',
          name: 'Detail',
          component: () => import('@/views/detail/index.vue')
        },
        {
          path: '/logistics',
          name: 'Logistics',
          component: () => import('@/views/logistics/index.vue')
        },
        {
          path: '/vip',
          name: 'Vip',
          component: () => import('@/views/vip/index.vue')
        },
        {
          path: '/community',
          name: 'Community',
          component: () => import('@/views/community/index.vue')
        },
        {
          path: '/about',
          name: 'About',
          component: () => import('@/views/about/index.vue')
        },
        {
          path: '/order',
          name: 'Order',
          component: () => import('@/views/order/index.vue')
        },
        {
          path: '/help',
          name: 'Help',
          component: () => import('@/views/help/index.vue')
        },
        {
          path: '/message',
          name: 'Message',
          component: () => import('@/views/message/index.vue')
        },
        {
          path: '/sign',
          name: 'Sign',
          component: () => import('@/views/sign/index.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('@/views/login/index.vue')
    }

  ]
})

export default router
